﻿//-----------------------------------------------------------------------
// <copyright file="ActioningHandingFilter.cs" company="SLWY Enterprises">
// * Copyright (C) 2017 四川商旅无忧科技有限公司 版权所有。
// * version : 1.0
// * author  : qinchaoyue
// * FileName: ActioningHandingFilter.cs
// * history : created by qinchaoyue 2017-11-01 01:28:49
// </copyright>
//-----------------------------------------------------------------------

using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Filters;
using Slwy.MVC.Models;

namespace Slwy.Mvc.Filters
{
    public class ActioningHandingFilter : ActionFilterAttribute
    {
        public override void OnActionExecuting(ActionExecutingContext context)
        {
            if (context.ModelState.IsValid == false)
            {
                context.Result = new OkObjectResult(new MSlwyResult { Code = 0, Message = "验证失败", Data = new BadRequestObjectResult(context.ModelState), });
            }
        }
    }
}
